<html>

<head>
    <meta charset="utf-8">
    <title>设备列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../css/admin.css" media="all">
    <script src="../layui/layui.js"></script>
</head>

<body class="layui-layout-body">
    <div class="layui-card">
        <div class="search" style="padding-top:10px;padding-left:10px;padding-bottom:10px">
            <form class="layui-form" action>
                <div class="layui-inline">
                    <div class="layui-input-inline">
                        <input type="text" id="name" autocomplete="off" class="layui-input" placeholder="输入设备名称">
                    </div>
                    <div class="layui-input-inline">
                        <input type="text" id="type" autocomplete="off" class="layui-input" placeholder="输入设备类型">
                    </div>
                    <button type="button" class="layui-btn m120 safe-btn1 layui-btn-normal" id="search"><i
                            class="layui-icon layui-icon-search layuiadmin-button-btn"></i></button>
                </div>
            </form>
        </div>
        <div style="margin-left: 10px;margin-right:10px;">
            <table class="" id="facilityList" lay-filter="facilityList"></table>
        </div>

    </div>
    <script type="text/html" id="default">
        <div class="layui-btn-container">
            <button class="layui-btn layui-btn-sm" lay-event="add">添加</button>
            <button class="layui-btn layui-btn-sm" lay-event="delete">删除</button>
            <button class="layui-btn layui-btn-sm" lay-event="update">编辑</button>
        </div>
    </script>

    <script type="text/html" id="barDemo">
        <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
    </script>

    <script>
        layui.config({
            base: './' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'console']);

        layui.use('table', function () {
            var table = layui.table;

            table.render({
                elem: '#facilityList',
                cellMinWidth: 80, //全局定义常规单元格的最小宽度，layui 2.2.1 新增,
                toolbar: 'default',
                defaultToolbar: ['filter', 'exports', 'print'],
                cols: [
                    [{
                            type: 'checkbox',
                            fixed: 'left'
                        },
                        {
                            field: 'name',
                            title: '名称',
                            width: 100
                        }, {
                            field: 'type',
                            title: '设备类型'
                        }, {
                            field: 'status',
                            title: '状态'
                        }, {
                            field: 'location',
                            title: '位置'
                        }, {
                            field: 'option',
                            title: '操作',
                            toolbar: '#barDemo'
                        }
                    ]
                ],
                data: [{
                    "name": "投影机",
                    "type": "投影机",
                    "status": "在线",
                    "location": "展厅",
                }, {
                    "name": "电视",
                    "type": "电视",
                    "status": "在线",
                    "location": "展厅",
                }],
                page: true
            });


            table.on('tool(facilityList)', function (obj) {
                var data = obj.data;
                if (obj.event === 'detail') {
                    window.location.href = '../repair/application_detail.html';
                }
            });
        });
    </script>


    <div class="layui-layer-move"></div>
</body>

</html>